package linuxbox.bookmark.bean;

import org.apache.log4j.Logger;

import linuxbox.bean.*;
import linuxbox.bookmark.logic.*;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2002</p>
 * <p>Company: </p>
 * @author unascribed
 * @version 1.0
 */

public class BookmarkBean extends BaseBean
{
  protected static Logger logger = Logger.getLogger(BookmarkBean.class.getName());

  //each BaseBean derived class should define this
  static protected BeanDef beanDef;

  protected BeanDef getBeanDef()
  {
    return beanDef;
  }

  public BookmarkBean()
  {
  }

  protected void setupFields() throws Exception
  {
    if (beanDef == null)
    {
      //Set the table name and the data object associated with the table
      beanDef = new BeanDef("bookmark", BookmarkEntry.class);

      //Setup the fields for the db object
      //name, fieldType, isKey, allowNull, defaultValue, description
      DBField field = beanDef.addKeyField("id", DBField.INT_TYPE, false, "1", "");
      field.setAutoIncrement(true);

      beanDef.addField("name", DBField.STRING_TYPE, false, "", "");
      beanDef.addField("url", DBField.STRING_TYPE, false, "", "");
      beanDef.addField("userid", DBField.INT_TYPE, false, "-1", "");
    }
  }
}
